package com.book.a20210523;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import com.book.a20210523.databinding.ActivityMainBinding;

import android.view.View;
import android.widget.Toast;


public class MainActivity extends AppCompatActivity implements View.OnClickListener {
    ActivityMainBinding binding;
    private static final int ID = 1010;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = ActivityMainBinding.inflate(getLayoutInflater());
        setContentView(binding.getRoot());
        binding.go.setOnClickListener(this);

    }
    public void goQqWz(String QQ, int district, String quantity){
        String url = "https://pay.qq.com/h5/index.shtml?" +
                "m=buy&c=game&dialog=0" + "&midasApiVersion=5" +
                "&transactionid=B5D85C0E-74BB-42AF-9CCB-C5B6BC702B4D1584611437534" +
                "&dh=1" + "&pf=mds_storeopen_qb-__mds_default_v1_0_0.navgame_v1.0-android&appid=1450002258" +
                "&zoneid=" + district + "&n=" + quantity +
                "&as=1" + "&aid=&wxAppid2=wx951bdcac522929b6" +
                "&u=" + QQ + "&r=www.rxfang6.com";
        QqUtils.openQQWeb(this,url);
    }

    @Override
    public void onClick(View v) {
            try {
                goQqWz(binding.qq.getText(),Integer.parseInt( binding.qh.getText()) + ID,binding.sl.getText());
            }catch (Exception e){
                Toast.makeText(MainActivity.this,"请勿输入空数据\n警告:"+e.getMessage(),Toast.LENGTH_SHORT).show();
                e.printStackTrace();
            }
    }
}
